package com.mayikt.job;

import com.mayikt.service.EbookSnapshotService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
 public class EbookSnapshotJob {

    private static final Logger LOG = LoggerFactory.getLogger(EbookSnapshotJob.class);
    @Resource
    private EbookSnapshotService ebookSnapshotService;

    /**
     * 每隔3分钟执行一次
     * 自定义cron表达式跑批
     * 只有等上一次执行完成，下一次才会在下一个时间点执行，错过就错过
     */
    @Scheduled(cron = "0/180 * * * * ?")
    public void cron() {
        ebookSnapshotService.genSnapshot();
    }

 }
